<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>javascrpt</title>
	<style>

	</style>
</head>
<body>
	<div class="home">
		<button class="btn" onclick="myFunction()">点击显示日期</button>
		<p id="demo"></p>
	</div>
	<script>
		//需求1：点击显示日期
		// let btn = document.getElementsByClassName(".btn")
		let isShow = false
		let text = document.getElementById("demo")
		function myFunction(){
			if(isShow){
				text.innerHTML = ''
			}else{
				text.innerHTML = Date()
			}
			isShow = !isShow
		}
	</script>
</body>
</html>